package fr.vvins.core.catalog.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import fr.vvins.core.dao.EntityImpl;


/**
 * Region entity
 */
@Entity
@Table(schema="vvins",name="VV_REGION")
public class Region extends EntityImpl implements Serializable {

	private static final long serialVersionUID = 8092184967756469558L;
	
	@Id
	@GeneratedValue
	@Column(name="ID")
	private Integer id;
	
	@ManyToOne
	@JoinColumn(name="COUNTRY_ID")
	private Country country;

	@Basic
	@Column(name="NAME")
	private String name;
	
	@Basic
	@Column(name="POSTAL_CODE")
	private String postalCode;
	
	@OneToMany(mappedBy="region")
	private Set<Domain> domains;
	
	@OneToMany(mappedBy="region")
	private Set<Variety> varieties;
	
	public Region() {
	}

	public Region(Country country, String name, String postalCode) {
		this.country = country;
		this.name = name;
		this.postalCode = postalCode;
	}

	@Override
	public Integer getId() {
		return this.id;
	}

	@Override
	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPostalCode() {
		return this.postalCode;
	}

	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}

	public Country getCountry() {
		return country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}

	public Set<Domain> getDomains() {
		return domains;
	}

	public void setDomains(Set<Domain> domains) {
		this.domains = domains;
	}

	public Set<Variety> getVarieties() {
		return varieties;
	}

	public void setVarieties(Set<Variety> varieties) {
		this.varieties = varieties;
	}

}
